"""
反射
hasattr,getattr
"""

class Student:

    role = 'student'

    def __init__(self, name):
        self.name = name

    def run(self):
        print("run")

    @classmethod
    def eat(cls):
        print("eat")

    @staticmethod
    def study():
        print("study")

# 类
print(Student.role)
# 反射查看属性
print(getattr(Student, 'role'))
# 反射调用方法
getattr(Student, 'eat')()
getattr(Student, 'study')()

# 对象
student = Student("zhangsan")
print(student.name) # zhangsan
print(getattr(student, 'name')) #zhangsan
getattr(student, 'run')() #run


# 模块





